package vip.george.p1822;

public class P1822 {

    public int arraySign(int[] nums) {
//        int len = nums.length;
        int negative = 0;
        for (int num : nums) {
            if (num == 0) {
                return 0;
            }
            if (num < 0) {
                negative++;
            }
        }
        if (negative % 2 == 0) {
            return 1;
        } else {
            return -1;
        }
    }

    public static void main(String[] args) {
        P1822 p = new P1822();
        System.out.println(p.arraySign(new int[]{-1, -2, -3, -4, 3, 2, 1}));
        System.out.println(p.arraySign(new int[]{-1, 1, -1, 1, -1}));
        System.out.println(p.arraySign(new int[]{-1, 0, 1, 1}));
    }
}
